import scala.io.StdIn
import scala.util.Random

/**
 * @author Hanpeng
 * @date 2022/1/14 16:17
 * @description:
 */
trait Show{
  var win:Int=_;
  var fail:Int=_;
  var peace:Int=_;
  def showFist(chose:String): String = {
    chose match {
      case "1"=>"剪刀"
      case "2"=>"石头"
      case "3"=>"布"
    }
  }
}
class Guest(var name:String,var score:Int)extends Show {


}
class Computer(var name:String,var score:Int)extends Show{

}
object PeopleAndMachineGuessFiest {
  def initGame():Unit={
    val begin= "*******************"
    val middle="*****猜拳开始******"
    val end=   "*******************"
    println(begin)
    println(middle)
    println(end)


  }
  def playGame(g:Guest,h:Computer):Unit={
    var flag=true
    while (flag) {
      println("要开始么? y/n")
      val yesOrNo: String = StdIn.readLine()
      if("y".equals(yesOrNo)) {
        flag=false
      }
      println(yesOrNo)
    }
    var ff=true
    while (ff) {
      println("请出拳! 1.剪刀 2.石头 3.布")
      //相关逻辑 比较
    }





  }
  def main(args: Array[String]): Unit = {
    initGame()
    val juese = Map("1" -> "刘备", "2" -> "关于", "3" -> "张飞")

    println("请选择对战角色(1.刘备 2.关羽 3.张飞)")

    val keyJuese: String = StdIn.readLine()

    val heroName: String = juese(keyJuese)
    println(s"您选择了与${heroName}作战")
    val guest = new Guest("游客", 0)

    println(guest.showFist("2"))



    for(i<- 1 to 10) {
      println(Random.nextInt(3)+1) //[1,3]
    }
  }
}
